<template>
  <div class='meeting-seats'>
    <div class="to-center">
      <span>{{label}}:</span>
      <el-upload class="avatar-uploader" :action="upload" :show-file-list="false" :on-success="handleAvatarSuccess" accept='image/jpg, image/jpeg,image/png'>
        <img v-if="imageUrl" :src="imageUrl" class="avatar" :title="label">
        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
      </el-upload>
    </div>
  </div>
</template>
<script>
export default {
  props:['label'],
  components: {},
  name: "",
  data() {
    return {
      imageUrl: require('../../../../assets/images/default.png'),
      upload:picPath,
    };
  },
  methods: {
    handleAvatarSuccess(e) {
      _g.toMessage({
        status:e.status,
        msg:e.status=='0'?"成功":"失败"
      })
      this.imageUrl=e.data
      this.$store.state.add.info[this.label=='弹幕背景图'?'headPic':'seatPic']=e.data
    }
  },
  created() {

  },
  mounted(){
    this.imageUrl=this.$store.state.records.meetingInfo[this.label=='弹幕背景图'?'bgPic':'seatUrl']||this.imageUrl
  }
};
</script>
<style lang="scss" scoped>
.meeting-seats {
  height: 100%;
  flex-grow: 1;
  position: relative;

  .to-center{
    display: flex;
    width: auto;
    min-height: 300px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);

    >span{
      display: inline-block;
      width: 100px;
      font-size: 16px;
    }
  }
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409eff;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 800px;
    height: 500px;
    line-height: 500px;
    text-align: center;
  }
  .avatar {
    width: 800px;
    height: 500px;
    display: block;
  }
}
</style>